<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/2
 * Time: 17:34
 */
namespace app\online\controller;

use think\Controller;
use think\Session;
use think\Db;

class Common extends Controller
{
	//判断是否登录
	public function _initialize()
	{
		if(!Session::has('adminuser')){
			$this->redirect('index/index');
		}
		//获取头像
		$img = Db::table('admin')->where('id',Session::get('adminuser.id'))->value('logo');
		$this->assign('image',$img);
		//获取结算个数
		$applyCount = Db::table('apply')->where('status',1)->group('date')->count();;
		$this->assign('applyCount',$applyCount);
	}
	
	/**
	 * 城市级联操作
	 */
	public function find($id=0){
		
		$data = Db::table('District')->where("upid={$id}")->select();
		return json($data);
	}
	
}